package com.example.demo.es;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@Document(indexName = "blog",useServerConfiguration = true,refreshInterval = "-1",createIndex = false)
public class ESBlogEntity {

    @Id
    private Long id;

    @Field(type = FieldType.Text,analyzer = "id_max_word")
    private String title;

    @Field(type = FieldType.Text,analyzer = "id_max_word")
    private String author;

    @Field(type = FieldType.Text,analyzer = "id_max_word")
    private String content;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private String createTime;

    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis")
    private String updateTime;

}
